/*
 *    Thing Game Library
 *   Copyright (C)2005 - 2010 Eduardo Nunes Pereira (eduardonunesp at gmail dot com)
 *
 *   This program/library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 *   This program/library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 *    You should have received a copy of the GNU Lesser General Public
 * License along with this program/library ; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef __EVENT_MANAGER_HPP__
#define __EVENT_MANAGER_HPP__

#include <SDL/SDL.h>
#include <NonCopyable.hpp>
#include "Exception.hpp"

namespace Thing
{
    namespace Events
    {
        class EventsException : public Utils::Exception
        {
        public:
            typedef enum
            {
                UNKNOW_KEY,
                UNKNOW_EVENT,
                KEY_OUT_OF_RANGE
            } FailType;

            EventsException(FailType fail, const std::string& what) : 
                Utils::Exception(what), fail_type(fail)  {}
            FailType fail_type;
        };
       
        class Window;
        class Keyboard;
        class Mouse;
        class EventManager : public Utils::NonCopyable
        {
        public:
            EventManager() {}
            virtual ~EventManager();

            void initialize();
            void update();

            void showMouseCursor(bool show = true);
            bool onWindowQuit();
            bool onKeyPressed(int k);
            bool onKeyReleased(int k);

        private:
            Window   *_window;
            Keyboard *_keyboard;
            Mouse    *_mouse;
            SDL_Event _event;
        };
    }
}

#endif /* __EVENT_MANAGER_HPP__ */


